package com.zllkj.mm.base;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.zllkj.mm.AppManager;
import com.zllkj.mm.common.ContentType;
import com.zllkj.mm.module.general.EmptyFragment;
import com.zllkj.mm.util.EmptyUtils;


/**
 * Created by Leon on 18/10/25.
 */

public class CommonActivity extends BaseCommonActivity {

    public static final String EXTRA_CONTENT_TYPE = "extra_content_type";
    ContentType mContentType;


    public static Intent newIntent(Context context, ContentType contentType) {
        Intent intent = new Intent(context, CommonActivity.class);
        intent.putExtra(EXTRA_CONTENT_TYPE, contentType);
        return intent;
    }

    public static BaseFragment baseFragment;

    public static Intent newIntent(BaseFragment b) {
        baseFragment = b;
        Intent intent = new Intent(AppManager.getAppManager().currentActivity(), CommonActivity.class);
        return intent;
    }

    @Override
    protected boolean initBundle(Bundle bundle) {
        mContentType = (ContentType) getIntent().getSerializableExtra(EXTRA_CONTENT_TYPE);
        return true;
    }

    @Override
    protected BaseFragment getFirstFragment() {
        if (EmptyUtils.isEmpty(mContentType)) {
            return baseFragment;
        }
        switch (mContentType) {
//            case WEB:
//                return MeetQRFragment.newInstance(getIntent().getIntExtra("type", 0));
            default:
                return EmptyFragment.newInstance();
        }
    }
}
